/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.yourtrade.common;

import com.mycompany.yourtrade.model.SmsConfig;
import com.mycompany.yourtrade.common.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SmsClient {

    @Autowired(required = false)
    private SmsService service;

    @Autowired(required = false)
    private SmsConfig smsConfig;

    public void setService(SmsService service) {
        this.service = service;
    }

    public String sendSMS(String mobile, String content) {
        //发短信，测试通过    

        String result = service.SendSMS(smsConfig.getUsername(), smsConfig.getPassword(), mobile, content.concat(smsConfig.getSignature()));

        return "0";
    }
}
